// 公表管理
export const tableOption = {
  border: true,
  index: true,
  indexLabel: "序号",
  stripe: true,
  menuAlign: "center",
  align: "center",
  searchMenuSpan: 6,
  editBtn: false,
  delBtn: false,
  align: "center",
  viewBtn: false,
  addBtn: false,
  columnBtn: false,
  dialogEscape: false,
  dialogClickModal: false,
  column: [
    {
      type: "input",
      label: "主键",
      hide: true,
      prop: "id"
    },
    {
      type: "input",
      label: "楼层",
      width: "150px",
      prop: "projectFloorNumber"
    },
    {
      type: "input",
      label: "面积(㎡)",
      width: "200px",
      prop: "area",
      formatter: function(row, value, label, column) {
        if (value || value == 0) {
          return parseFloat(value).toFixed(2);
        } else {
          return value;
        }
      }
    },
    {
      type: "input",
      label: "电表名称",
      prop: "meterName"
    },
    {
      type: "input",
      label: "创建者",
      hide: true,
      prop: "createBy"
    },
    {
      type: "input",
      label: "创建时间",
      hide: true,
      prop: "createDate"
    },
    {
      type: "input",
      label: "更新者",
      hide: true,
      prop: "updateBy"
    },
    {
      type: "input",
      width: "150px",
      label: "最近编辑时间",
      hide: true,
      prop: "updateDate"
    },
    {
      type: "input",
      hide: true,
      label: "备注信息",
      prop: "remarks"
    },
    {
      type: "input",
      label: "删除",
      hide: true,
      prop: "isDeleted"
    },
    {
      type: "input",
      hide: true,
      label: "逻辑删除标记（0：显示；1：隐藏",
      prop: "delFlag"
    }
  ]
};

export const formOption = {
  detail: true,
  size: "small",
  emptyBtn: false,
  submitBtn: false,
  menuSpan: 4,
  menuPosition: "left",
  column: [
    // {
    //   label: "电表倍率",
    //   span: 5,
    //   prop: "multipleRate",
    //   rules: [
    //     {
    //       required: true,
    //       message: "请输入电表倍率",
    //       trigger: "blur"
    //     },
    //     {
    //       validator: (rule, value, callback) => {
    //         if (!/^(?!0+$)(?!0*\.0*$)\d{1,8}(\.\d{1,2})?$/.test(value)) {
    //           callback(new Error("数据格式不对,请重新输入"));
    //         } else {
    //           callback();
    //         }
    //       },
    //       trigger: "blur"
    //     }
    //   ]
    // },
    {
      labelWidth: 125,
      label: "电费单价(元/度)",
      prop: "unitPrice",
      span: 7,
      rules: [
        {
          required: true,
          message: "请输入电费单价(元/度)",
          trigger: "blur"
        },
        {
          validator: (rule, value, callback) => {
            if (!/^(?!0+$)(?!0*\.0*$)\d{1,8}(\.\d{1,2})?$/.test(value)) {
              callback(new Error("数据格式不对,请重新输入"));
            } else {
              callback();
            }
          },
          trigger: "blur"
        }
      ]
    },
    {
      labelWidth: 125,
      label: "总收费面积(㎡)",
      prop: "totalArea",
      span: 7,
      rules: [
        {
          required: true,
          message: "请输入总收费面积(㎡)",
          trigger: "blur"
        },
        {
          validator: (rule, value, callback) => {
            if (!/^(?!0+$)(?!0*\.0*$)\d{1,8}(\.\d{1,2})?$/.test(value)) {
              callback(new Error("数据格式不对,请重新输入"));
            } else {
              callback();
            }
          },
          trigger: "blur"
        }
      ]
    }
  ]
};

// 弹窗表格
export const tableOptionForm = {
  border: true,
  index: true,
  indexLabel: "序号",
  stripe: true,
  menuAlign: "center",
  align: "center",
  searchMenuSpan: 6,
  editBtn: false,
  delBtn: false,
  align: "center",
  viewBtn: false,
  addBtn: false,
  columnBtn: false,
  dialogEscape: false,
  dialogClickModal: false,
  column: [
    {
      type: "input",
      label: "主键",
      hide: true,
      prop: "id"
    },
    {
      type: "input",
      label: "楼层水表管理ID",
      hide: true,
      prop: "publicMeterRelateId"
    },
    {
      type: "input",
      label: "房产ID",
      hide: true,
      prop: "projectId"
    },
    {
      type: "input",
      label: "房产编号",
      prop: "projectNumber"
    },
    {
      type: "input",
      label: "房号",
      prop: "projectName"
    },
    {
      type: "input",
      label: "面积(㎡)",
      prop: "projectArea"
    }
  ]
};
